﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Controls;
using HYBatchPrinter.Layout;

namespace HYBatchPrinter.Commands
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdAddPictureFrame : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
            if (cmdData.Application.ActiveUIDocument.Document.ActiveView.ViewType != ViewType.DrawingSheet)
			{
				YJKMessageBox.Show("请切换到图纸视图下运行此命令！");
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			new AddPictureFrame(cmdData).ShowDialog();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
